

import 'package:flutter/material.dart';

class PageBulidDemo extends StatelessWidget {
  final List<MaterialColor> contianerColors = [ Colors.red,
    Colors.lime];


  @override
  Widget build(BuildContext context) {
    return PageView.builder(
      itemCount: 2,
      scrollDirection: Axis.horizontal,
      itemBuilder: (BuildContext context, int index) {
        return _bulidPageItem(index);
      },

    );
  }

  Widget _bulidPageItem(int index) {
    return Container(
      color:  contianerColors[index],
      child: Center(
        child: Text('$index'),
      ),
    );
  }

}